<include file="Public/min-header"/>
<div class="wrapper">
    <!-- Content Header (Page header) -->
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <!--<div class="container-fluid">-->
        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="pull-right">
                        <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                    </div>
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list"></i> 兑换商品</h3>
                    </div>
                    <div class="panel-body">
                        <form action="" method="post" enctype="multipart/form-data"  >
                            <table class="table table-bordered">
                                <tbody>

                                <tr class="coupon_sec4">
                                    <td class="col-sm-1">选择会员:</td>
                                    <td class="col-sm-11">
                                        <div class="form-group">

                                            <a class="btn btn-primary" href="javascript:void(0);" onclick="selectUser()" ><i class="fa fa-search"></i>搜索用户</a>


                                        </div>
                                    </td>
                                </tr>

                                <tr class="coupon_sec4">
                                    <td colspan="2">
                                        <div class="form-group">
                                            <table class="table table-bordered">
                                                <thead>
                                                <tr>
                                                    <th style="display:none">选择</th>
                                                    <th class="text-left">头像</th>
                                                    <th class="text-left">昵称</th>
                                                    <th class="text-left">操作</th>
                                                </tr>
                                                </thead>
                                                <tbody id="goods_list">
                                                <foreach name="prom_goods" item="vo">
                                                    <tr>
                                                        <td style="display:none"><input type="checkbox" name="goods_id[]" checked="checked" value="{$vo.goods_id}"/></td>
                                                        <td class="text-left">{$vo.goods_name}</td>

                                                        <td class="text-left"><a href="javascript:void(0)" onclick="javascript:$(this).parent().parent().remove();">删除</a></td>
                                                    </tr>
                                                </foreach>
                                                </tbody>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                                <tr  >
                                    <td>选择礼品:</td>
                                    <td>
                                        <select name="dh_goods_id" id="dh_goods_id" class="form-control" style="width:250px;">
                                            <option value="0">--请选择礼品--</option>
                                            <foreach name="lists" item="v" key="k" >
                                                <option value="{$v['id']}"  >{$v['title']}（扣除{$v[num]}推荐数量）</option>
                                            </foreach>
                                        </select>
                                    </td>
                                </tr>



                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 提交
                                        </button>
                                        <!--<input type="reset" class="btn btn-default pull-right" value="重置">-->
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </form>

                    </div>
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>


    function selectUser(){
        var goods_id = [];
        //过滤选择重复商品
        $('input[name*="goods_id"]').each(function(i,o){
            goods_id.push($(o).val());
        });
        var url = '/index.php?m=Admin&c=Coach&a=search_user';
//        var url = '/index.php?m=Admin&c=Activity&a=search_activity_goods&goods_id='+goods_id+'&t='+Math.random();
        layer.open({
            type: 2,
            title: '选择用户',
            shadeClose: true,
            shade: 0.3,
            area: ['70%', '80%'],
            content: url,
        });
    }





    function call_back(table_html)
    {
        layer.closeAll('iframe');
        $('#goods_list').append(table_html);
    }





    function checkUserUpdate(){
        var name = $('input[name="name"]').val();
        var tel = $('#tel').val();
        var cate_id = $('#cate_id').val();
        var error ='';
//        var goods_l = $('#goods_list').html();
//        if(goods_l ==null||goods_l ==''){
//            error += "请选择用户\n";
//        }
        if(name == ''){
            error += "真实姓名不能为空\n";
        }

        if(cate_id == 0){
            error += "请选择分类\n";
        }

        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
</script>

</body>
</html>